<?php
/**
 *
 *
 * @author: mgli<mgli@kaikeba.com>
 * @date: 2021/3/8
 * @version: 1.0
 * @copyright: mgli@kaikeba.com @ 2021
 * @filename: AdminController.php
 */

namespace App\Admin\Controllers;

use App\Models\AdminRoleUser;
use Illuminate\Support\Facades\Auth;

class AdminController extends \Dcat\Admin\Controllers\AdminController
{

    public function isAdmin() : bool
    {
        $login_uid = Auth::guard('admin')->id();
        $role = app(AdminRoleUser::class)->query()->where('user_id', $login_uid)->get();
        if (in_array(1, $role->pluck('role_id')->toArray())){
            return true;
        }
        return false;
    }
}